package pens.penObjects
{
	import flash.display.CapsStyle;
	import flash.display.JointStyle;
	
	import pens.PenType;
	import pens.interfaces.IPenPlayer;

	/**
	 * 钢笔基类 
	 * @author Administrator
	 * 
	 */	
	public class Pen extends ActionPenSprite implements IPenPlayer
	{
		private static var instance:Pen;
		/**
		 *单例模式
		 *
		 **/
		public static function getInstance():Pen{
			if(!instance) instance=new Pen();
			return instance;
		}
		/***************************************************/
		
		
		
		
		
		
		
		public function Pen()
		{
			super();
		}
		
		override protected function _end():void
		{
			// TODO Auto Generated method stub
			super._end();
			_penName=PenType.PEN
		}
		
		override protected function _lineTo(x:Number, y:Number, size:Number=10, color:uint=0):void
		{
			// TODO Auto Generated method stub
			super._lineTo(x, y, size, color);
			graphics.lineStyle(size,color, 1,true,"normal",CapsStyle.ROUND,JointStyle.MITER,5);	
			graphics.curveTo(_oldX,_oldY,x,y)
		//	graphics.lineTo(_oldX,_oldY)
		//	graphics.lineTo(x,y); 
		 
			graphics.endFill(); 
			_oldX=x
			_oldY=y
		}
		private var _oldX:Number
	    private var _oldY:Number
		override protected function _moveTo(x:Number, y:Number, size:Number=10, color:uint=0):void
		{
			// TODO Auto Generated method stub
			super._moveTo(x, y, size, color);
			graphics.lineStyle(size,color, 1,true,"normal",CapsStyle.ROUND,JointStyle.MITER,5);
			graphics.moveTo(x,y);  
			graphics.lineTo(x,y); 
			graphics.endFill(); 
			_oldX=x
			_oldY=y
		}
		
		
		
		
		override public function dispose():void
		{
			// TODO Auto Generated method stub
			super.dispose();
			drawFloor()
			while(numChildren){
				removeChildAt(0)
			}
		}
		
		
	}
}